/**
 * @author LKQ
 * @date 2022/2/15 10:41
 * @description 思路，每次增加，直到不是子字符串，
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        System.out.println(solution.maxRepeating("ababc", "ac"));
    }

    public int maxRepeating(String sequence, String word) {
        int m = sequence.length(), n = word.length();
        int ans = 0; String temp = word;
        for (int i = 0; i < m / n; i++) {
            if (!sequence.contains(word)) {
                break;
            }
            ans++;
            word += temp;
        }
        return ans;
    }
}
